﻿using IntelligentAgriculture.Contracts.Dto.Output;
using IntelligentAgriculture.Contracts.Interface.SheepFileModelInterface;
using IntelligentAgriculture.Domain.Entity;
using IntelligentAgriculture.WebAPI.Application.Command.SheepfilemodelCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.SheepfilemodelCommandHandler
{
    public class SheepfileListCommandHandle :IRequestHandler<SheepfileListCommand, Results<SheepfileInfo>>
    {
        private readonly ISheepFileModelService _sheepFileModelService;
        public SheepfileListCommandHandle(ISheepFileModelService sheepFileModelService)
        {
            _sheepFileModelService = sheepFileModelService;
        }
        public async Task<Results<SheepfileInfo>> Handle(SheepfileListCommand request, CancellationToken cancellationToken)
        {
            var list = await _sheepFileModelService.ListSheepfilemodel(request.SheepFileId);
            return Results<SheepfileInfo>.DataResult(list);
        }
    }
}
